package com.only4play.web.resource;

import com.only4play.usercenter.userperson.api.UserPersonApi;
import com.only4play.usercenter.userperson.bean.UserPersonBean;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liyuncong
 * @version 1.0
 * @file DubboTestResource
 * @brief DubboTestResource
 * @details DubboTestResource
 * @date 2024-01-18
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2024-01-18               liyuncong          Created
 */
@RestController
@RequestMapping("/dubbo")
public class DubboTestResource {

    @DubboReference
    private UserPersonApi userPersonApi;

    @GetMapping("/queryByLoginUsername")
    public ResponseEntity<UserPersonBean> queryByLoginUsername(
        @RequestParam("loginUsername") String loginUsername
    ) {
        UserPersonBean userPersonBean = userPersonApi.queryUserPersonByLoginUsername(loginUsername);
        return ResponseEntity.ok(userPersonBean);
    }
}
